<form action="{:url()}" method="post" class="form_single">
  <div class="box">
    <div class="box-body">
      <div class="row">
        <div class="col-md-4">
          <div class="form-group">
            <label>入职公司</label>
            <span class="">（员工入职公司）</span>
              <select name="company_id" class="form-control" id="company_list">
                <option value="0" >请选择公司</option>
                  {volist name='company_list' id='vo'}
                      <option value="{$vo['id']}" >{$vo['name']}</option>
                  {/volist}
              </select>
          </div>
        </div>
        <div class="col-md-4">
          <div class="form-group">
            <label>入职部门</label>
            <span class="">（员工入职部门）</span>
              <select name="branch_id" class="form-control" id="branch_list">
                <option value="0" >请选择部门</option>
                  <!-- {volist name='branch_list' id='vo'}
                      <option value="{$vo['id']}" >{$vo['branch_name']}</option>
                  {/volist} -->
              </select>
          </div>
        </div>
        <div class="col-md-4">
          <div class="form-group">
            <label>所属组</label>
            <span class="">（员工所属部门组非必选）</span>
              <select name="group_id" class="form-control" id="group_list">
                  <option value="6" >请选择组</option>
                 <!--  {volist name='group_list' id='vo'}
                      <option value="{$vo['id']}" >{$vo['group_name']}</option>
                  {/volist} -->
              </select>
          </div>
        </div>

        <div class="col-md-4">
          <div class="form-group">
            <label>入职岗位</label>
            <span>（员工入职岗位）</span>
            <input class="form-control" name="position" placeholder="请输入入职岗位" type="text" >
          </div>
        </div>

        <div class="col-md-4">
          <div class="form-group">
            <label>入职时间</label>
            <span class="">（员工入职时间）</span>
              <input type="text" name="entry_time" readonly="readonly" style="cursor:pointer"  class="form-control test-item" placeholder="请选择时间" >
          </div>
        </div>

        <div class="col-md-4">
          <div class="form-group">
            <label>姓名</label>
            <span>（员工姓名）</span>
            <input class="form-control" name="staff_name" placeholder="请输入姓名" type="text" >
          </div>
        </div>

        <div class="col-md-4">
          <div class="form-group">
            <label>姓别</label>
            <span>（员工姓别）</span>
            <select name="sex" class="form-control">
                  <option value="1" >男</option>
                  <option value="2" >女</option>
              </select>
          </div>
        </div>

        <div class="col-md-4">
          <div class="form-group">
            <label>身份证号</label>
            <span>（员工身份证号）</span>
            <input class="form-control" name="card_id" placeholder="请输入身份证号" type="text">
          </div>
        </div>

        <div class="col-md-4">
          <div class="form-group">
            <label>手机号</label>
            <span>（员工手机号）</span>
            <input class="form-control" name="phones" placeholder="请输入手机号" type="text">
          </div>
        </div>

      </div>
    </div>
  </div>
  <div class="box-footer" style="
    text-align: center;">
    <button  type="submit" class="btn ladda-button ajax-post" data-style="slide-up" target-form="form_single">
    <span class="ladda-label"><i class="fa fa-send"></i> 确 定</span>
    </button>
    <a class="btn" onclick="javascript:history.back(-1);return false;"><i class="fa fa-history"></i> 返 回</a>
  </div>
  <script src="__STATIC__/module/admin/laydate/laydate.js"></script>
  <script type="text/javascript">
    $('#company_list').change(function(){
    var options=$(this).children("option:selected");
     // options.attr('selected','selected'); 
    var company_id=options.val();
    $('#branch_list option').remove();
    $('#group_list option').remove();
     $("#group_list").append("<option value='6'>请选择组名</option>");
     $("#branch_list").append("<option value=''>请选择部门名</option>");
    $.post('/admin/branch/branchlist',{company_id:company_id},function(data){
      $(data.data).each(function(index,item){ 
          var option="<option value="+item.id+">"+item.branch_name+"</option>"
          $("#branch_list").append(option);  
            // console.log(item); 
        }); 
    });  
  })

  $('#branch_list').change(function(){
    var options=$(this).children("option:selected");
     options.attr('selected','selected'); 
    var branch_id=options.val();
    $('#group_list option').remove();
     $("#group_list").append("<option value='6'>请选择组名</option>");
    // alert(branch_id);
    $.post('/admin/group/grouplist',{branch_id:branch_id},function(data){
      $(data.data).each(function(index,item){ 
          var option="<option value="+item.id+">"+item.group_name+"</option>"
          $("#group_list").append(option);  
            console.log(item); 
        }); 
    });  
  })
    // 时间插件
    $('body').delegate('.test-item','click', function(){
    lay('.test-item').each(function(){
    laydate.render({
      elem: this
      ,trigger: 'click'
    });
 });
  });
   
  </script>
  
</form>
